<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv=Content-Type content="text/html;charset=utf-8" />
        <title>会员注册</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="format-detection" content="telephone=no">
        <link href="{$docroot}static/css/wshop_main_style.css?v={$cssversion}" type="text/css" rel="Stylesheet" />
        <link href="{$docroot}static/css/common.css?v={$cssversion}" type="text/css" rel="Stylesheet" />
        <script type="text/javascript" src="{$docroot}static/script/jquery-2.1.1.min.js?v={$cssversion}"></script>
        <script type="text/javascript" src="{$docroot}static/script/main.js?v={$cssversion}"></script>
        <script type='text/javascript'>
            $(function() {
                window.onresize = resize;
                resize();
            });
            function resize() {
                var wrapper = document.getElementById('hh');
                wrapper.style.marginTop = ((document.documentElement.clientHeight - wrapper.clientHeight) / 2) + "px";
            }
            function reg(node) {
                var name = $('#set-form-name').val();
                var phone = $('#set-form-phone').val();
                if (name !== '' && phone !== '') {
                    node.innerHTML = '提交中';
                    $.post(shoproot + '?/Uc/AjaxReg/', {
                        name: name,
                        phone: phone,
                        openid: $('#openid').val(),
                        address: $('#address').val(),
                        head: $('#head').val(),
                        bbname: $('#set-form-bbname').val(),
                        bbage: $('#set-form-bbage').val(),
                        sex: $('#sex').val()
                    }, function(r) {
                        alert(r);
                        if (parseInt(r) === 1) {
                            location.href = shoproot + '?/Uc/home/';
                        } else {
                            alert('提交失败');
                            node.innerHTML = '注册失败';
                        }
                    });
                }
            }
        </script>
    </head>
    <body style='background: #fff'>
        <input type='hidden' value='{$openid}' id='openid' />
        <input type='hidden' value='{$address}' id='address' />
        <input type='hidden' value='{$head}' id='head' />
        <input type='hidden' value='{$sex}' id='sex' />
        <div style='width:65%;margin:0 auto;' id='hh'>
            <img src='{if $head}{$head}/0{else}{$docroot}static/images/login/profle_1.png{/if}' height="100px" style='display: block;margin:0 auto;border-radius: 50px;'/>

            <div class="gs-label gs-label-h">姓名</div>
            <div class="gs-text clearfix">
                <input type="text" id="set-form-name" />
            </div>

            <div class="gs-label gs-label-h" style="margin-top: 12px;">电话</div>
            <div class="gs-text clearfix">
                <input type="tel" name="tel" id="set-form-phone"/>
            </div>

            <div class="gs-label gs-label-h" style="margin-top: 12px;">性别</div>
            <select id="set-from-sex">
                <option value="m">男</option>
                <option value="f">女</option>
            </select>

            <a class="button green" id="wechat-payment-btn" href="javascript:;" onclick="reg(this);"
               style='margin:20px auto;padding:5px 0;width:95px;border-radius: 20px;font-size: 13px;'
               >马上注册</a>
        </div>
    </body>
</html>